﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using lgweb.common;
using LGCourt.Logic.BLL;
using LGCourt.Logic.NBL.DBEntities;

namespace lgweb.inside.information
{
    public partial class detail : NeedValidatePage
    {
        private int _aid = 1;
        public string _cate = "1";
        private string _cateName = "简报专栏";
        protected void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);
            if (!this.IsPostBack)
            {
                GetParam();
                GetInfo();
            }
        }

        private void GetParam()
        {
            this._cate = string.IsNullOrEmpty(Request.QueryString["cate"]) ? "1" : Request.QueryString["cate"];
            switch (_cate)
            {
                case "1":
                    this._cateName = "简报专栏";
                    break;
                case "2":
                    this._cateName = "排头兵专栏";
                    break;
                case "3":
                    this._cateName = "党务工作";
                    break;
                case "4":
                    this._cateName = "信息报送";
                    break;
                case "5":
                    this._cateName = "廉政专栏";
                    break;
                default:
                    this._cateName = "简报专栏";
                    break;

            }
            this.spBaoCate.InnerHtml = this._cateName;
            this._aid = string.IsNullOrEmpty(Request.QueryString["aid"]) ? 1 : Convert.ToInt32(Request.QueryString["aid"]);
        }

        private void GetInfo()
        {
            BBS bll = new BBS();
            InfoCondition param = new InfoCondition();
            param.aid = this._aid;

            vPortalArticleTitleEx result = (vPortalArticleTitleEx)bll.GetInfo(param);

            if (result != null)
            {
                this.author.InnerHtml = result.author;
                this.title.InnerHtml = result.title;
                this.InfoFrom.InnerHtml = result.from;
                this.content.InnerHtml = result.summary;
                this.viewCount.InnerHtml = result.allowcomment.ToString();
                this.dtime.InnerHtml = result.createart.ToString();

            }
        }

    }
}